home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / gdb-4.12 / gdb / c-exp-ta.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-03  |  66.1 KB  |  2,311 lines

  1.  
  2. # line 38 "./c-exp.y"
  3.  
  4. #include "defs.h"
  5. #include "expression.h"
  6. #include "value.h"
  7. #include "parser-defs.h"
  8. #include "language.h"
  9. #include "c-lang.h"
  10. #include "bfd.h" /* Required by objfiles.h.  */
  11. #include "symfile.h" /* Required by objfiles.h.  */
  12. #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
  13.  
  14. /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
  15.    as well as gratuitiously global symbol names, so we can have multiple
  16.    yacc generated parsers in gdb.  Note that these are only the variables
  17.    produced by yacc.  If other parser generators (bison, byacc, etc) produce
  18.    additional global names that conflict at link time, then those parser
  19.    generators need to be fixed instead of adding those names to this list. */
  20.  
  21. #define    yymaxdepth c_maxdepth
  22. #define    yyparse    c_parse
  23. #define    yylex    c_lex
  24. #define    yyerror    c_error
  25. #define    yylval    c_lval
  26. #define    yychar    c_char
  27. #define    yydebug    c_debug
  28. #define    yypact    c_pact    
  29. #define    yyr1    c_r1            
  30. #define    yyr2    c_r2            
  31. #define    yydef    c_def        
  32. #define    yychk    c_chk        
  33. #define    yypgo    c_pgo        
  34. #define    yyact    c_act        
  35. #define    yyexca    c_exca
  36. #define yyerrflag c_errflag
  37. #define yynerrs    c_nerrs
  38. #define    yyps    c_ps
  39. #define    yypv    c_pv
  40. #define    yys    c_s
  41. #define    yy_yys    c_yys
  42. #define    yystate    c_state
  43. #define    yytmp    c_tmp
  44. #define    yyv    c_v
  45. #define    yy_yyv    c_yyv
  46. #define    yyval    c_val
  47. #define    yylloc    c_lloc
  48. #define yyreds    c_reds        /* With YYDEBUG defined */
  49. #define yytoks    c_toks        /* With YYDEBUG defined */
  50.  
  51. #ifndef YYDEBUG
  52. #define    YYDEBUG    0        /* Default to no yydebug support */
  53. #endif
  54.  
  55. int
  56. yyparse PARAMS ((void));
  57.  
  58. static int
  59. yylex PARAMS ((void));
  60.  
  61. void
  62. yyerror PARAMS ((char *));
  63.  
  64.  
  65. # line 105 "./c-exp.y"
  66. typedef union 
  67.   {
  68.     LONGEST lval;
  69.     struct {
  70.       LONGEST val;
  71.       struct type *type;
  72.     } typed_val;
  73.     double dval;
  74.     struct symbol *sym;
  75.     struct type *tval;
  76.     struct stoken sval;
  77.     struct ttype tsym;
  78.     struct symtoken ssym;
  79.     int voidval;
  80.     struct block *bval;
  81.     enum exp_opcode opcode;
  82.     struct internalvar *ivar;
  83.  
  84.     struct type **tvec;
  85.     int *ivec;
  86.   } YYSTYPE;
  87.  
  88. # line 128 "./c-exp.y"
  89. /* YYSTYPE gets defined by %union */
  90. static int
  91. parse_number PARAMS ((char *, int, int, YYSTYPE *));
  92. # define INT 257
  93. # define FLOAT 258
  94. # define STRING 259
  95. # define NAME 260
  96. # define TYPENAME 261
  97. # define NAME_OR_INT 262
  98. # define STRUCT 263
  99. # define CLASS 264
  100. # define UNION 265
  101. # define ENUM 266
  102. # define SIZEOF 267
  103. # define UNSIGNED 268
  104. # define COLONCOLON 269
  105. # define TEMPLATE 270
  106. # define ERROR 271
  107. # define SIGNED_KEYWORD 272
  108. # define LONG 273
  109. # define SHORT 274
  110. # define INT_KEYWORD 275
  111. # define CONST_KEYWORD 276
  112. # define VOLATILE_KEYWORD 277
  113. # define LAST 278
  114. # define REGNAME 279
  115. # define VARIABLE 280
  116. # define ASSIGN_MODIFY 281
  117. # define THIS 282
  118. # define ABOVE_COMMA 283
  119. # define OROR 284
  120. # define ANDAND 285
  121. # define EQUAL 286
  122. # define NOTEQUAL 287
  123. # define LEQ 288
  124. # define GEQ 289
  125. # define LSH 290
  126. # define RSH 291
  127. # define UNARY 292
  128. # define INCREMENT 293
  129. # define DECREMENT 294
  130. # define ARROW 295
  131. # define BLOCKNAME 296
  132. #define yyclearin yychar = -1
  133. #define yyerrok yyerrflag = 0
  134. extern int yychar;
  135. extern int yyerrflag;
  136. #ifndef YYMAXDEPTH
  137. #define YYMAXDEPTH 150
  138. #endif
  139. YYSTYPE yylval, yyval;
  140. # define YYERRCODE 256
  141.  
  142. # line 887 "./c-exp.y"
  143.  
  144.  
  145. /* Take care of parsing a number (anything that starts with a digit).
  146.    Set yylval and return the token type; update lexptr.
  147.    LEN is the number of characters in it.  */
  148.  
  149. /*** Needs some error checking for the float case ***/
  150.  
  151. static int
  152. parse_number (p, len, parsed_float, putithere)
  153.      register char *p;
  154.      register int len;
  155.      int parsed_float;
  156.      YYSTYPE *putithere;
  157. {
  158.   register LONGEST n = 0;
  159.   register LONGEST prevn = 0;
  160.   register int i = 0;
  161.   register int c;
  162.   register int base = input_radix;
  163.   int unsigned_p = 0;
  164.   int long_p = 0;
  165.   unsigned LONGEST high_bit;
  166.   struct type *signed_type;
  167.   struct type *unsigned_type;
  168.  
  169.   if (parsed_float)
  170.     {
  171.       /* It's a float since it contains a point or an exponent.  */
  172.       putithere->dval = atof (p);
  173.       return FLOAT;
  174.     }
  175.  
  176.   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
  177.   if (p[0] == '0')
  178.     switch (p[1])
  179.       {
  180.       case 'x':
  181.       case 'X':
  182.     if (len >= 3)
  183.       {
  184.         p += 2;
  185.         base = 16;
  186.         len -= 2;
  187.       }
  188.     break;
  189.  
  190.       case 't':
  191.       case 'T':
  192.       case 'd':
  193.       case 'D':
  194.     if (len >= 3)
  195.       {
  196.         p += 2;
  197.         base = 10;
  198.         len -= 2;
  199.       }
  200.     break;
  201.  
  202.       default:
  203.     base = 8;
  204.     break;
  205.       }
  206.  
  207.   while (len-- > 0)
  208.     {
  209.       c = *p++;
  210.       if (c >= 'A' && c <= 'Z')
  211.     c += 'a' - 'A';
  212.       if (c != 'l' && c != 'u')
  213.     n *= base;
  214.       if (c >= '0' && c <= '9')
  215.     n += i = c - '0';
  216.       else
  217.     {
  218.       if (base > 10 && c >= 'a' && c <= 'f')
  219.         n += i = c - 'a' + 10;
  220.       else if (len == 0 && c == 'l') 
  221.             long_p = 1;
  222.       else if (len == 0 && c == 'u')
  223.         unsigned_p = 1;
  224.       else
  225.         return ERROR;    /* Char not a digit */
  226.     }
  227.       if (i >= base)
  228.     return ERROR;        /* Invalid digit in this base */
  229.  
  230.       /* Portably test for overflow (only works for nonzero values, so make
  231.      a second check for zero).  */
  232.       if((prevn >= n) && n != 0)
  233.      unsigned_p=1;        /* Try something unsigned */
  234.       /* If range checking enabled, portably test for unsigned overflow.  */
  235.       if(RANGE_CHECK && n!=0)
  236.       {    
  237.      if((unsigned_p && (unsigned)prevn >= (unsigned)n))
  238.         range_error("Overflow on numeric constant.");     
  239.       }
  240.       prevn=n;
  241.     }
  242.  
  243.      /* If the number is too big to be an int, or it's got an l suffix
  244.     then it's a long.  Work out if this has to be a long by
  245.     shifting right and and seeing if anything remains, and the
  246.     target int size is different to the target long size.
  247.  
  248.     In the expression below, we could have tested
  249.             (n >> TARGET_INT_BIT)
  250.     to see if it was zero,
  251.     but too many compilers warn about that, when ints and longs
  252.     are the same size.  So we shift it twice, with fewer bits
  253.     each time, for the same result.  */
  254.  
  255.     if (   (TARGET_INT_BIT != TARGET_LONG_BIT 
  256.             && ((n >> 2) >> (TARGET_INT_BIT-2)))   /* Avoid shift warning */
  257.         || long_p)
  258.       {
  259.          high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
  260.      unsigned_type = builtin_type_unsigned_long;
  261.      signed_type = builtin_type_long;
  262.       }
  263.     else 
  264.       {
  265.      high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
  266.      unsigned_type = builtin_type_unsigned_int;
  267.      signed_type = builtin_type_int;
  268.       }    
  269.  
  270.    putithere->typed_val.val = n;
  271.  
  272.    /* If the high bit of the worked out type is set then this number
  273.       has to be unsigned. */
  274.  
  275.    if (unsigned_p || (n & high_bit)) 
  276.      {
  277.         putithere->typed_val.type = unsigned_type;
  278.      }
  279.    else 
  280.      {
  281.         putithere->typed_val.type = signed_type;
  282.      }
  283.  
  284.    return INT;
  285. }
  286.  
  287. struct token
  288. {
  289.   char *operator;
  290.   int token;
  291.   enum exp_opcode opcode;
  292. };
  293.  
  294. static const struct token tokentab3[] =
  295.   {
  296.     {">>=", ASSIGN_MODIFY, BINOP_RSH},
  297.     {"<<=", ASSIGN_MODIFY, BINOP_LSH}
  298.   };
  299.  
  300. static const struct token tokentab2[] =
  301.   {
  302.     {"+=", ASSIGN_MODIFY, BINOP_ADD},
  303.     {"-=", ASSIGN_MODIFY, BINOP_SUB},
  304.     {"*=", ASSIGN_MODIFY, BINOP_MUL},
  305.     {"/=", ASSIGN_MODIFY, BINOP_DIV},
  306.     {"%=", ASSIGN_MODIFY, BINOP_REM},
  307.     {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
  308.     {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
  309.     {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
  310.     {"++", INCREMENT, BINOP_END},
  311.     {"--", DECREMENT, BINOP_END},
  312.     {"->", ARROW, BINOP_END},
  313.     {"&&", ANDAND, BINOP_END},
  314.     {"||", OROR, BINOP_END},
  315.     {"::", COLONCOLON, BINOP_END},
  316.     {"<<", LSH, BINOP_END},
  317.     {">>", RSH, BINOP_END},
  318.     {"==", EQUAL, BINOP_END},
  319.     {"!=", NOTEQUAL, BINOP_END},
  320.     {"<=", LEQ, BINOP_END},
  321.     {">=", GEQ, BINOP_END}
  322.   };
  323.  
  324. /* Read one token, getting characters through lexptr.  */
  325.  
  326. static int
  327. yylex ()
  328. {
  329.   int c;
  330.   int namelen;
  331.   unsigned int i;
  332.   char *tokstart;
  333.   char *tokptr;
  334.   int tempbufindex;
  335.   static char *tempbuf;
  336.   static int tempbufsize;
  337.   
  338.  retry:
  339.  
  340.   tokstart = lexptr;
  341.   /* See if it is a special token of length 3.  */
  342.   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
  343.     if (STREQN (tokstart, tokentab3[i].operator, 3))
  344.       {
  345.     lexptr += 3;
  346.     yylval.opcode = tokentab3[i].opcode;
  347.     return tokentab3[i].token;
  348.       }
  349.  
  350.   /* See if it is a special token of length 2.  */
  351.   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
  352.     if (STREQN (tokstart, tokentab2[i].operator, 2))
  353.       {
  354.     lexptr += 2;
  355.     yylval.opcode = tokentab2[i].opcode;
  356.     return tokentab2[i].token;
  357.       }
  358.  
  359.   switch (c = *tokstart)
  360.     {
  361.     case 0:
  362.       return 0;
  363.  
  364.     case ' ':
  365.     case '\t':
  366.     case '\n':
  367.       lexptr++;
  368.       goto retry;
  369.  
  370.     case '\'':
  371.       /* We either have a character constant ('0' or '\177' for example)
  372.      or we have a quoted symbol reference ('foo(int,int)' in C++
  373.      for example). */
  374.       lexptr++;
  375.       c = *lexptr++;
  376.       if (c == '\\')
  377.     c = parse_escape (&lexptr);
  378.  
  379.       yylval.typed_val.val = c;
  380.       yylval.typed_val.type = builtin_type_char;
  381.  
  382.       c = *lexptr++;
  383.       if (c != '\'')
  384.     {
  385.       namelen = skip_quoted (tokstart) - tokstart;
  386.       if (namelen > 2)
  387.         {
  388.           lexptr = tokstart + namelen;
  389.           if (lexptr[-1] != '\'')
  390.         error ("Unmatched single quote.");
  391.           namelen -= 2;
  392.           tokstart++;
  393.           goto tryname;
  394.         }
  395.       error ("Invalid character constant.");
  396.     }
  397.       return INT;
  398.  
  399.     case '(':
  400.       paren_depth++;
  401.       lexptr++;
  402.       return c;
  403.  
  404.     case ')':
  405.       if (paren_depth == 0)
  406.     return 0;
  407.       paren_depth--;
  408.       lexptr++;
  409.       return c;
  410.  
  411.     case ',':
  412.       if (comma_terminates && paren_depth == 0)
  413.     return 0;
  414.       lexptr++;
  415.       return c;
  416.  
  417.     case '.':
  418.       /* Might be a floating point number.  */
  419.       if (lexptr[1] < '0' || lexptr[1] > '9')
  420.     goto symbol;        /* Nope, must be a symbol. */
  421.       /* FALL THRU into number case.  */
  422.  
  423.     case '0':
  424.     case '1':
  425.     case '2':
  426.     case '3':
  427.     case '4':
  428.     case '5':
  429.     case '6':
  430.     case '7':
  431.     case '8':
  432.     case '9':
  433.       {
  434.     /* It's a number.  */
  435.     int got_dot = 0, got_e = 0, toktype;
  436.     register char *p = tokstart;
  437.     int hex = input_radix > 10;
  438.  
  439.     if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
  440.       {
  441.         p += 2;
  442.         hex = 1;
  443.       }
  444.     else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
  445.       {
  446.         p += 2;
  447.         hex = 0;
  448.       }
  449.  
  450.     for (;; ++p)
  451.       {
  452.         /* This test includes !hex because 'e' is a valid hex digit
  453.            and thus does not indicate a floating point number when
  454.            the radix is hex.  */
  455.         if (!hex && !got_e && (*p == 'e' || *p == 'E'))
  456.           got_dot = got_e = 1;
  457.         /* This test does not include !hex, because a '.' always indicates
  458.            a decimal floating point number regardless of the radix.  */
  459.         else if (!got_dot && *p == '.')
  460.           got_dot = 1;
  461.         else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  462.              && (*p == '-' || *p == '+'))
  463.           /* This is the sign of the exponent, not the end of the
  464.          number.  */
  465.           continue;
  466.         /* We will take any letters or digits.  parse_number will
  467.            complain if past the radix, or if L or U are not final.  */
  468.         else if ((*p < '0' || *p > '9')
  469.              && ((*p < 'a' || *p > 'z')
  470.                   && (*p < 'A' || *p > 'Z')))
  471.           break;
  472.       }
  473.     toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
  474.         if (toktype == ERROR)
  475.       {
  476.         char *err_copy = (char *) alloca (p - tokstart + 1);
  477.  
  478.         memcpy (err_copy, tokstart, p - tokstart);
  479.         err_copy[p - tokstart] = 0;
  480.         error ("Invalid number \"%s\".", err_copy);
  481.       }
  482.     lexptr = p;
  483.     return toktype;
  484.       }
  485.  
  486.     case '+':
  487.     case '-':
  488.     case '*':
  489.     case '/':
  490.     case '%':
  491.     case '|':
  492.     case '&':
  493.     case '^':
  494.     case '~':
  495.     case '!':
  496.     case '@':
  497.     case '<':
  498.     case '>':
  499.     case '[':
  500.     case ']':
  501.     case '?':
  502.     case ':':
  503.     case '=':
  504.     case '{':
  505.     case '}':
  506.     symbol:
  507.       lexptr++;
  508.       return c;
  509.  
  510.     case '"':
  511.  
  512.       /* Build the gdb internal form of the input string in tempbuf,
  513.      translating any standard C escape forms seen.  Note that the
  514.      buffer is null byte terminated *only* for the convenience of
  515.      debugging gdb itself and printing the buffer contents when
  516.      the buffer contains no embedded nulls.  Gdb does not depend
  517.      upon the buffer being null byte terminated, it uses the length
  518.      string instead.  This allows gdb to handle C strings (as well
  519.      as strings in other languages) with embedded null bytes */
  520.  
  521.       tokptr = ++tokstart;
  522.       tempbufindex = 0;
  523.  
  524.       do {
  525.     /* Grow the static temp buffer if necessary, including allocating
  526.        the first one on demand. */
  527.     if (tempbufindex + 1 >= tempbufsize)
  528.       {
  529.         tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
  530.       }
  531.     switch (*tokptr)
  532.       {
  533.       case '\0':
  534.       case '"':
  535.         /* Do nothing, loop will terminate. */
  536.         break;
  537.       case '\\':
  538.         tokptr++;
  539.         c = parse_escape (&tokptr);
  540.         if (c == -1)
  541.           {
  542.         continue;
  543.           }
  544.         tempbuf[tempbufindex++] = c;
  545.         break;
  546.       default:
  547.         tempbuf[tempbufindex++] = *tokptr++;
  548.         break;
  549.       }
  550.       } while ((*tokptr != '"') && (*tokptr != '\0'));
  551.       if (*tokptr++ != '"')
  552.     {
  553.       error ("Unterminated string in expression.");
  554.     }
  555.       tempbuf[tempbufindex] = '\0';    /* See note above */
  556.       yylval.sval.ptr = tempbuf;
  557.       yylval.sval.length = tempbufindex;
  558.       lexptr = tokptr;
  559.       return (STRING);
  560.     }
  561.  
  562.   if (!(c == '_' || c == '$'
  563.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  564.     /* We must have come across a bad character (e.g. ';').  */
  565.     error ("Invalid character '%c' in expression.", c);
  566.  
  567.   /* It's a name.  See how long it is.  */
  568.   namelen = 0;
  569.   for (c = tokstart[namelen];
  570.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  571.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  572.        c = tokstart[++namelen])
  573.     ;
  574.  
  575.   /* The token "if" terminates the expression and is NOT 
  576.      removed from the input stream.  */
  577.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  578.     {
  579.       return 0;
  580.     }
  581.  
  582.   lexptr += namelen;
  583.  
  584.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  585.      and $$digits (equivalent to $<-digits> if you could type that).
  586.      Make token type LAST, and put the number (the digits) in yylval.  */
  587.  
  588.   tryname:
  589.   if (*tokstart == '$')
  590.     {
  591.       register int negate = 0;
  592.       c = 1;
  593.       /* Double dollar means negate the number and add -1 as well.
  594.      Thus $$ alone means -1.  */
  595.       if (namelen >= 2 && tokstart[1] == '$')
  596.     {
  597.       negate = 1;
  598.       c = 2;
  599.     }
  600.       if (c == namelen)
  601.     {
  602.       /* Just dollars (one or two) */
  603.       yylval.lval = - negate;
  604.       return LAST;
  605.     }
  606.       /* Is the rest of the token digits?  */
  607.       for (; c < namelen; c++)
  608.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  609.       break;
  610.       if (c == namelen)
  611.     {
  612.       yylval.lval = atoi (tokstart + 1 + negate);
  613.       if (negate)
  614.         yylval.lval = - yylval.lval;
  615.       return LAST;
  616.     }
  617.     }
  618.  
  619.   /* Handle tokens that refer to machine registers:
  620.      $ followed by a register name.  */
  621.  
  622.   if (*tokstart == '$') {
  623.     for (c = 0; c < NUM_REGS; c++)
  624.       if (namelen - 1 == strlen (reg_names[c])
  625.       && STREQN (tokstart + 1, reg_names[c], namelen - 1))
  626.     {
  627.       yylval.lval = c;
  628.       return REGNAME;
  629.     }
  630.     for (c = 0; c < num_std_regs; c++)
  631.      if (namelen - 1 == strlen (std_regs[c].name)
  632.      && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
  633.        {
  634.      yylval.lval = std_regs[c].regnum;
  635.      return REGNAME;
  636.        }
  637.   }
  638.   /* Catch specific keywords.  Should be done with a data structure.  */
  639.   switch (namelen)
  640.     {
  641.     case 8:
  642.       if (STREQN (tokstart, "unsigned", 8))
  643.     return UNSIGNED;
  644.       if (current_language->la_language == language_cplus
  645.       && STREQN (tokstart, "template", 8))
  646.     return TEMPLATE;
  647.       if (STREQN (tokstart, "volatile", 8))
  648.     return VOLATILE_KEYWORD;
  649.       break;
  650.     case 6:
  651.       if (STREQN (tokstart, "struct", 6))
  652.     return STRUCT;
  653.       if (STREQN (tokstart, "signed", 6))
  654.     return SIGNED_KEYWORD;
  655.       if (STREQN (tokstart, "sizeof", 6))      
  656.     return SIZEOF;
  657.       break;
  658.     case 5:
  659.       if (current_language->la_language == language_cplus
  660.       && STREQN (tokstart, "class", 5))
  661.     return CLASS;
  662.       if (STREQN (tokstart, "union", 5))
  663.     return UNION;
  664.       if (STREQN (tokstart, "short", 5))
  665.     return SHORT;
  666.       if (STREQN (tokstart, "const", 5))
  667.     return CONST_KEYWORD;
  668.       break;
  669.     case 4:
  670.       if (STREQN (tokstart, "enum", 4))
  671.     return ENUM;
  672.       if (STREQN (tokstart, "long", 4))
  673.     return LONG;
  674.       if (current_language->la_language == language_cplus
  675.       && STREQN (tokstart, "this", 4))
  676.     {
  677.       static const char this_name[] =
  678.                  { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
  679.  
  680.       if (lookup_symbol (this_name, expression_context_block,
  681.                  VAR_NAMESPACE, (int *) NULL,
  682.                  (struct symtab **) NULL))
  683.         return THIS;
  684.     }
  685.       break;
  686.     case 3:
  687.       if (STREQN (tokstart, "int", 3))
  688.     return INT_KEYWORD;
  689.       break;
  690.     default:
  691.       break;
  692.     }
  693.  
  694.   yylval.sval.ptr = tokstart;
  695.   yylval.sval.length = namelen;
  696.  
  697.   /* Any other names starting in $ are debugger internal variables.  */
  698.  
  699.   if (*tokstart == '$')
  700.     {
  701.       yylval.ivar =  lookup_internalvar (copy_name (yylval.sval) + 1);
  702.       return VARIABLE;
  703.     }
  704.  
  705.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  706.      functions or symtabs.  If this is not so, then ...
  707.      Use token-type TYPENAME for symbols that happen to be defined
  708.      currently as names of types; NAME for other symbols.
  709.      The caller is not constrained to care about the distinction.  */
  710.   {
  711.     char *tmp = copy_name (yylval.sval);
  712.     struct symbol *sym;
  713.     int is_a_field_of_this = 0;
  714.     int hextype;
  715.  
  716.     sym = lookup_symbol (tmp, expression_context_block,
  717.              VAR_NAMESPACE,
  718.              current_language->la_language == language_cplus
  719.              ? &is_a_field_of_this : (int *) NULL,
  720.              (struct symtab **) NULL);
  721.     /* Call lookup_symtab, not lookup_partial_symtab, in case there are
  722.        no psymtabs (coff, xcoff, or some future change to blow away the
  723.        psymtabs once once symbols are read).  */
  724.     if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
  725.         lookup_symtab (tmp))
  726.       {
  727.     yylval.ssym.sym = sym;
  728.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  729.     return BLOCKNAME;
  730.       }
  731.     if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
  732.         {
  733. #if 0
  734.       /* In "A::x", if x is a member function of A and there happens
  735.          to be a type (nested or not, since the stabs don't make that
  736.          distinction) named x, then this code incorrectly thinks we
  737.          are dealing with nested types rather than a member function.  */
  738.  
  739.       char *p;
  740.       char *namestart;
  741.       struct symbol *best_sym;
  742.  
  743.       /* Look ahead to detect nested types.  This probably should be
  744.          done in the grammar, but trying seemed to introduce a lot
  745.          of shift/reduce and reduce/reduce conflicts.  It's possible
  746.          that it could be done, though.  Or perhaps a non-grammar, but
  747.          less ad hoc, approach would work well.  */
  748.  
  749.       /* Since we do not currently have any way of distinguishing
  750.          a nested type from a non-nested one (the stabs don't tell
  751.          us whether a type is nested), we just ignore the
  752.          containing type.  */
  753.  
  754.       p = lexptr;
  755.       best_sym = sym;
  756.       while (1)
  757.         {
  758.           /* Skip whitespace.  */
  759.           while (*p == ' ' || *p == '\t' || *p == '\n')
  760.         ++p;
  761.           if (*p == ':' && p[1] == ':')
  762.         {
  763.           /* Skip the `::'.  */
  764.           p += 2;
  765.           /* Skip whitespace.  */
  766.           while (*p == ' ' || *p == '\t' || *p == '\n')
  767.             ++p;
  768.           namestart = p;
  769.           while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
  770.              || (*p >= 'a' && *p <= 'z')
  771.              || (*p >= 'A' && *p <= 'Z'))
  772.             ++p;
  773.           if (p != namestart)
  774.             {
  775.               struct symbol *cur_sym;
  776.               /* As big as the whole rest of the expression, which is
  777.              at least big enough.  */
  778.               char *tmp = alloca (strlen (namestart));
  779.  
  780.               memcpy (tmp, namestart, p - namestart);
  781.               tmp[p - namestart] = '\0';
  782.               cur_sym = lookup_symbol (tmp, expression_context_block,
  783.                            VAR_NAMESPACE, (int *) NULL,
  784.                            (struct symtab **) NULL);
  785.               if (cur_sym)
  786.             {
  787.               if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
  788.                 {
  789.                   best_sym = cur_sym;
  790.                   lexptr = p;
  791.                 }
  792.               else
  793.                 break;
  794.             }
  795.               else
  796.             break;
  797.             }
  798.           else
  799.             break;
  800.         }
  801.           else
  802.         break;
  803.         }
  804.  
  805.       yylval.tsym.type = SYMBOL_TYPE (best_sym);
  806. #else /* not 0 */
  807.       yylval.tsym.type = SYMBOL_TYPE (sym);
  808. #endif /* not 0 */
  809.       return TYPENAME;
  810.         }
  811.     if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
  812.     return TYPENAME;
  813.  
  814.     /* Input names that aren't symbols but ARE valid hex numbers,
  815.        when the input radix permits them, can be names or numbers
  816.        depending on the parse.  Note we support radixes > 16 here.  */
  817.     if (!sym && 
  818.         ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
  819.          (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
  820.       {
  821.      YYSTYPE newlval;    /* Its value is ignored.  */
  822.     hextype = parse_number (tokstart, namelen, 0, &newlval);
  823.     if (hextype == INT)
  824.       {
  825.         yylval.ssym.sym = sym;
  826.         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  827.         return NAME_OR_INT;
  828.       }
  829.       }
  830.  
  831.     /* Any other kind of symbol */
  832.     yylval.ssym.sym = sym;
  833.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  834.     return NAME;
  835.   }
  836. }
  837.  
  838. void
  839. yyerror (msg)
  840.      char *msg;
  841. {
  842.   error (msg ? msg : "Invalid syntax in expression.");
  843. }
  844. int yyexca[] ={
  845. -1, 1,
  846.     0, -1,
  847.     -2, 0,
  848. -1, 45,
  849.     269, 66,
  850.     -2, 130,
  851. -1, 130,
  852.     269, 96,
  853.     -2, 127,
  854. -1, 183,
  855.     269, 67,
  856.     -2, 68,
  857.     };
  858. # define YYNPROD 131
  859. # define YYLAST 1006
  860. int yyact[]={
  861.  
  862.      9,    57,   204,   187,    53,     7,    55,    15,   184,     6,
  863.     51,    56,     8,   167,   104,   106,   107,    32,   110,    37,
  864.     38,    39,    40,   186,    36,   185,    42,   158,    41,    34,
  865.     35,    33,    43,    44,   168,   102,   109,    53,   108,   181,
  866.      9,    86,   162,    51,   114,     7,   160,    85,   114,     6,
  867.    105,   203,     8,    99,   175,    52,   121,   122,   115,   188,
  868.    111,   112,   115,    47,   100,   161,   209,    96,    47,    98,
  869.    168,    95,   206,    90,     2,   160,   200,    29,   165,   201,
  870.      9,    47,   199,   194,   164,   135,    28,    15,    52,   113,
  871.     27,    31,    25,    10,    97,   178,    14,    19,    57,    68,
  872.      1,    53,    94,    55,    58,   101,    59,    51,    56,     3,
  873.      0,     0,   191,     0,     0,     0,     0,     0,   167,   193,
  874.    101,    66,    74,    67,    73,    54,   134,   162,   128,   132,
  875.     27,   120,     0,    10,    57,    68,     0,    53,     0,    55,
  876.     58,   133,    59,    51,    56,     0,     0,   104,   106,   107,
  877.      0,   173,    52,   163,     0,    69,     0,    66,    74,    67,
  878.     73,    54,   174,     0,   179,     5,    57,     0,     0,    53,
  879.     27,    55,    58,    10,    59,    51,    56,   192,     0,    87,
  880.     89,     0,     0,   105,     0,    70,     0,     0,    52,     0,
  881.      0,    69,     0,    54,     0,   169,   170,     0,   171,   172,
  882.      0,   176,     0,   182,     0,     0,     0,     0,     0,     0,
  883.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  884.     52,    70,     0,     0,    16,    18,    23,    46,    32,    17,
  885.     37,    38,    39,    40,    13,    36,    30,    42,     0,    41,
  886.     34,    35,    33,    43,    44,    20,    21,    22,     0,    24,
  887.    159,     0,   104,   106,   107,     0,     0,    48,    49,    50,
  888.     11,    12,     0,    45,    16,    18,    23,    46,    32,    17,
  889.     37,    38,    39,    40,    13,    36,    30,    42,     0,    41,
  890.     34,    35,    33,    43,    44,    20,    21,    22,   105,    24,
  891.     48,    49,    50,     0,     0,     0,     0,     0,     0,     0,
  892.     11,    12,     0,    45,    16,    18,    23,    46,    32,    17,
  893.     37,    38,    39,    40,    13,    36,    30,    42,     0,    41,
  894.     34,    35,    33,    43,    44,    20,    21,    22,     0,    24,
  895.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  896.     11,    12,    75,    45,   129,    72,    71,    62,    63,    64,
  897.     65,    60,    61,   205,    48,    49,    50,     0,     0,   104,
  898.    130,   107,    37,    38,    39,    40,   208,    36,     0,    42,
  899.      0,    41,    34,    35,    33,    43,    44,   177,    75,     0,
  900.      0,    72,    71,    62,    63,    64,    65,    60,    61,     0,
  901.     48,    49,    50,    57,    68,   105,    53,     0,    55,    58,
  902.      0,    59,    51,    56,    57,    68,     0,    53,     0,    55,
  903.     58,     0,    59,    51,    56,     0,    66,     0,    67,    73,
  904.     54,     0,    48,    49,    50,     0,     0,    66,     0,    67,
  905.      0,    54,    57,    68,     0,    53,     0,    55,    58,     0,
  906.     59,    51,    56,    57,    68,     0,    53,    52,    55,    58,
  907.     69,    59,    51,    56,     0,    66,     0,    67,    52,    54,
  908.      0,    69,     0,     0,     0,     0,    66,     0,    67,    57,
  909.     54,     0,    53,     0,    55,    58,     0,    59,    51,    56,
  910.     70,    96,     0,    98,   177,    95,    52,     0,     0,    69,
  911.      0,    70,     0,    57,    68,     0,    53,    52,    55,    58,
  912.     69,    59,    51,    56,    57,     0,     0,    53,     0,    55,
  913.     58,     0,    59,    51,    56,     0,    66,     0,    67,    70,
  914.     54,     0,     0,    52,     0,     0,     0,    66,     0,    67,
  915.     57,    54,     0,    53,   101,    55,    58,     0,    59,    51,
  916.     56,    96,     0,    98,     0,    95,     0,    52,     0,     0,
  917.      0,     0,     0,    66,     0,    67,     0,    54,    52,     0,
  918.      0,     0,   104,   130,   107,    37,    38,    39,    40,    96,
  919.     36,    98,    42,    95,    41,    34,    35,    33,    43,    44,
  920.     57,     0,     0,    53,    52,    55,    58,     0,    59,    51,
  921.     56,     0,     0,     0,   101,     0,     0,    32,   105,    37,
  922.     38,    39,    40,     0,    36,     0,    42,    54,    41,    34,
  923.     35,    33,    43,    44,     0,     0,     0,     0,     0,     0,
  924.      0,     0,   101,     0,     0,     0,     0,     0,   166,     0,
  925.      0,     0,     0,     0,    52,     0,     0,     0,     0,     0,
  926.     72,    71,    62,    63,    64,    65,    60,    61,     0,    48,
  927.     49,    50,    71,    62,    63,    64,    65,    60,    61,   103,
  928.     48,    49,    50,     0,     0,     0,   116,   117,   118,   119,
  929.      0,   123,     0,     0,     0,     0,     0,     0,     0,   127,
  930.    131,    62,    63,    64,    65,    60,    61,     0,    48,    49,
  931.     50,     0,    62,    63,    64,    65,    60,    61,     0,    48,
  932.     49,    50,     0,     0,    32,     0,    37,    38,    39,    40,
  933.      0,    36,     0,    42,     0,    41,    34,    35,    33,    43,
  934.     44,     0,     0,     0,     0,    48,    49,    50,     0,     0,
  935.      0,   183,     0,     0,     0,     0,     0,     0,     0,     0,
  936.      0,     0,    62,    63,    64,    65,    60,    61,     0,    48,
  937.     49,    50,     0,    62,    63,    64,    65,    60,    61,     0,
  938.     48,    49,    50,     0,     0,     0,     0,     0,     0,     0,
  939.      0,     0,   202,     0,     0,     0,     0,     0,     0,    92,
  940.     93,    64,    65,    60,    61,     0,    48,    49,    50,     0,
  941.      0,     0,     0,     0,     0,     0,   198,     0,     0,     0,
  942.     91,     0,     4,    77,    26,     0,     0,    92,    93,    76,
  943.     78,    79,    80,    81,    82,    83,    84,    88,    26,    26,
  944.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  945.      0,     0,     0,    60,    61,     0,    48,    49,    50,     0,
  946.      0,     0,     0,     0,     0,     0,     0,   124,   125,     0,
  947.    126,     0,     0,     0,     0,     0,     0,   136,   137,   138,
  948.    139,   140,   141,   142,   143,   144,   145,   146,   147,   148,
  949.    149,   150,   151,   152,   153,   154,   155,   156,   157,     0,
  950.      0,     0,     0,     0,     0,     0,     0,     0,     0,    26,
  951.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  952.      0,     0,   180,     0,     0,     0,     0,     0,     0,     0,
  953.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  954.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  955.      0,     0,   189,     0,     0,     0,   190,     0,    88,     0,
  956.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  957.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  958.      0,     0,     0,   195,     0,     0,   196,   197,     0,     0,
  959.      0,     0,     0,     0,     0,     0,     0,     0,     0,   180,
  960.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  961.      0,     0,   180,     0,     0,     0,   207,   197,     0,     0,
  962.      0,     0,     0,     0,     0,   180 };
  963. int yypact[]={
  964.  
  965.    -33, -1000,    24, -1000,    97, -1000,   -33,   -33,   -33,   -33,
  966.    -33,   -33,   -33,     7,   -33,   -33, -1000, -1000, -1000, -1000,
  967.  -1000, -1000, -1000, -1000, -1000, -1000,   531, -1000,  -234, -1000,
  968.   -246, -1000, -1000, -1000,  -237,  -257,  -213,  -246,  -246,  -246,
  969.   -246,  -217,  -246,  -244,  -244, -1000, -1000,   -33, -1000, -1000,
  970.    302,    99,   -33, -1000,   -33,   -33,   -33,   -33,   -33,   -33,
  971.    -33,   -33,   -33,   -33,   -33,   -33,   -33,   -33,   -33,   -33,
  972.    -33,   -33,   -33,   -33,   -33,   -33,    -3,  -242,    -3,    -3,
  973.     -3,    -3,    -3,    -3,    -3,   -33,     2,   -83,    97,    43,
  974.     37,    -8,    29,    29, -1000,    29,    29,    14,   443, -1000,
  975.  -1000,   -54,  -246, -1000, -1000, -1000, -1000, -1000, -1000,  -267,
  976.  -1000,  -250,  -272, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
  977.  -1000, -1000, -1000,    -1, -1000, -1000,    97, -1000, -1000,   -33,
  978.  -1000, -1000, -1000,   -33,    19,   -33,   432,    -3,    -3,    -3,
  979.    -36,   -36,   129,   129,   493,   493,   543,   543,   543,   543,
  980.    467,   456,   406,   395,   367,    61,    97,    97,  -113,    42,
  981.    -33, -1000, -1000,   -33,   -33, -1000, -1000,  -246, -1000, -1000,
  982.  -1000, -1000, -1000, -1000, -1000,   336,    41, -1000,    35, -1000,
  983.    503, -1000,   -42, -1000, -1000, -1000,  -273, -1000,  -244,    -3,
  984.     -3, -1000,    31,   -33,    47,    97,    -3,    -3, -1000, -1000,
  985.  -1000,  -244,    28, -1000, -1000,     4, -1000,   356, -1000, -1000 };
  986. int yypgo[]={
  987.  
  988.      0,   802,    73,   109,   100,    97,    77,    96,    65,   164,
  989.    803,    95,    64,    94,   102,    92,    53,   628,    91,    89,
  990.     86,    85,    41 };
  991. int yyr1[]={
  992.  
  993.      0,     4,     4,     3,     2,     2,     1,     1,     1,     1,
  994.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  995.      1,     1,     1,    21,     1,     7,    22,    22,    22,     8,
  996.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  997.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  998.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  999.      1,     1,     1,     1,     1,     1,    20,    20,     5,     6,
  1000.      6,     5,     5,     5,    15,    15,    15,    15,    15,    15,
  1001.     14,    14,    14,    14,    14,    13,    13,    13,    13,    13,
  1002.     16,    16,    12,    12,     9,     9,    10,    10,    10,    10,
  1003.     10,    10,    10,    10,    10,    10,    10,    10,    10,    10,
  1004.     10,    10,    10,    10,    10,    10,    10,    10,    10,    19,
  1005.     19,    19,    19,    11,    11,    17,    17,    17,    17,    18,
  1006.     18 };
  1007. int yyr2[]={
  1008.  
  1009.      0,     2,     2,     3,     2,     7,     5,     5,     5,     5,
  1010.      5,     5,     5,     5,     5,     5,     7,     7,     9,     7,
  1011.      7,     9,     9,     1,    11,     3,     0,     3,     7,     3,
  1012.      7,     9,     9,     7,     7,     7,     7,     7,     7,     7,
  1013.      7,     7,     7,     7,     7,     7,     7,     7,     7,     7,
  1014.      7,     7,     7,    11,     7,     7,     3,     3,     3,     2,
  1015.      3,     3,     3,     9,     3,     3,     3,     7,     7,     7,
  1016.      9,     2,     5,     3,     2,     4,     4,     5,     7,     7,
  1017.      3,     5,     3,     5,     2,     7,     5,     3,     5,     3,
  1018.      5,     7,     5,     7,     2,     7,     3,     3,     3,     3,
  1019.      5,     7,     5,     7,     7,     9,     5,     7,     5,     5,
  1020.      5,     5,     5,     3,     5,     3,    11,     5,     5,     2,
  1021.      3,     3,     3,     3,     7,     3,     3,     3,     3,     2,
  1022.      2 };
  1023. int yychk[]={
  1024.  
  1025.  -1000,    -4,    -2,    -3,    -1,    -9,    42,    38,    45,    33,
  1026.    126,   293,   294,   267,    -7,    40,   257,   262,   258,    -5,
  1027.    278,   279,   280,   259,   282,   -15,   -10,   123,   -20,    -6,
  1028.    269,   -18,   261,   275,   273,   274,   268,   263,   264,   265,
  1029.    266,   272,   270,   276,   277,   296,   260,    44,   293,   294,
  1030.    295,    46,    91,    40,    64,    42,    47,    37,    43,    45,
  1031.    290,   291,   286,   287,   288,   289,    60,    62,    38,    94,
  1032.    124,   285,   284,    63,    61,   281,    -1,   -10,    -1,    -1,
  1033.     -1,    -1,    -1,    -1,    -1,    40,   -22,    -9,    -1,    -9,
  1034.     -2,   269,   276,   277,   -14,    42,    38,   -13,    40,   -16,
  1035.    -12,    91,   269,   -17,   260,   296,   261,   262,   275,   273,
  1036.    275,   273,   274,   -19,   261,   275,   -17,   -17,   -17,   -17,
  1037.    -19,   273,   274,   -17,   -10,   -10,    -1,   -17,    -6,    42,
  1038.    261,   -17,    -6,    42,    -2,   -21,    -1,    -1,    -1,    -1,
  1039.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  1040.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   269,    -9,
  1041.     44,    -8,   125,    -8,    41,    41,   -17,   126,    42,   -14,
  1042.    -14,   -14,   -14,   -16,   -12,    40,   -14,    41,   -11,    -9,
  1043.    -10,    93,   257,   -17,   275,   275,   273,   275,    60,    -1,
  1044.     -1,    93,   -22,    58,    41,    -1,    -1,    -1,   -17,    41,
  1045.     41,    44,   269,    93,   275,    -9,    41,    -1,    -9,    62 };
  1046. int yydef[]={
  1047.  
  1048.      0,    -2,     1,     2,     4,     3,     0,     0,     0,     0,
  1049.      0,     0,     0,     0,    26,     0,    56,    57,    58,    59,
  1050.     60,    61,    62,    64,    65,    94,    74,    25,     0,    71,
  1051.      0,    73,    96,    97,    98,    99,   113,     0,     0,     0,
  1052.      0,   115,     0,     0,     0,    -2,   129,     0,    13,    14,
  1053.      0,     0,     0,    23,     0,     0,     0,     0,     0,     0,
  1054.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  1055.      0,     0,     0,     0,     0,     0,     6,     0,     7,     8,
  1056.      9,    10,    11,    12,    15,     0,     0,     0,    27,     0,
  1057.      0,     0,    75,    76,    77,    80,    82,    84,     0,    87,
  1058.     89,     0,     0,    72,   125,   126,   127,   128,   100,   102,
  1059.    106,   121,   122,   112,   119,   120,   108,   109,   110,   111,
  1060.    114,   121,   122,     0,   117,   118,     5,    16,    17,     0,
  1061.     -2,    19,    20,     0,     0,    26,    34,    35,    36,    37,
  1062.     38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
  1063.     48,    49,    50,    51,    52,     0,    54,    55,     0,     0,
  1064.      0,    30,    29,     0,     0,    33,    69,     0,    95,    78,
  1065.     79,    81,    83,    86,    88,     0,     0,    92,     0,   123,
  1066.     74,    90,     0,    -2,   103,   101,   104,   107,     0,    18,
  1067.     21,    22,     0,     0,    63,    28,    31,    32,    70,    85,
  1068.     93,     0,     0,    91,   105,     0,    24,    53,   124,   116 };
  1069. typedef struct { char *t_name; int t_val; } yytoktype;
  1070. #ifndef YYDEBUG
  1071. #    define YYDEBUG    0    /* don't allow debugging */
  1072. #endif
  1073.  
  1074. #if YYDEBUG
  1075.  
  1076. yytoktype yytoks[] =
  1077. {
  1078.     "INT",    257,
  1079.     "FLOAT",    258,
  1080.     "STRING",    259,
  1081.     "NAME",    260,
  1082.     "TYPENAME",    261,
  1083.     "NAME_OR_INT",    262,
  1084.     "STRUCT",    263,
  1085.     "CLASS",    264,
  1086.     "UNION",    265,
  1087.     "ENUM",    266,
  1088.     "SIZEOF",    267,
  1089.     "UNSIGNED",    268,
  1090.     "COLONCOLON",    269,
  1091.     "TEMPLATE",    270,
  1092.     "ERROR",    271,
  1093.     "SIGNED_KEYWORD",    272,
  1094.     "LONG",    273,
  1095.     "SHORT",    274,
  1096.     "INT_KEYWORD",    275,
  1097.     "CONST_KEYWORD",    276,
  1098.     "VOLATILE_KEYWORD",    277,
  1099.     "LAST",    278,
  1100.     "REGNAME",    279,
  1101.     "VARIABLE",    280,
  1102.     "ASSIGN_MODIFY",    281,
  1103.     "THIS",    282,
  1104.     ",",    44,
  1105.     "ABOVE_COMMA",    283,
  1106.     "=",    61,
  1107.     "?",    63,
  1108.     "OROR",    284,
  1109.     "ANDAND",    285,
  1110.     "|",    124,
  1111.     "^",    94,
  1112.     "&",    38,
  1113.     "EQUAL",    286,
  1114.     "NOTEQUAL",    287,
  1115.     "<",    60,
  1116.     ">",    62,
  1117.     "LEQ",    288,
  1118.     "GEQ",    289,
  1119.     "LSH",    290,
  1120.     "RSH",    291,
  1121.     "@",    64,
  1122.     "+",    43,
  1123.     "-",    45,
  1124.     "*",    42,
  1125.     "/",    47,
  1126.     "%",    37,
  1127.     "UNARY",    292,
  1128.     "INCREMENT",    293,
  1129.     "DECREMENT",    294,
  1130.     "ARROW",    295,
  1131.     ".",    46,
  1132.     "[",    91,
  1133.     "(",    40,
  1134.     "BLOCKNAME",    296,
  1135.     "-unknown-",    -1    /* ends search */
  1136. };
  1137.  
  1138. char * yyreds[] =
  1139. {
  1140.     "-no such reduction-",
  1141.     "start : exp1",
  1142.     "start : type_exp",
  1143.     "type_exp : type",
  1144.     "exp1 : exp",
  1145.     "exp1 : exp1 ',' exp",
  1146.     "exp : '*' exp",
  1147.     "exp : '&' exp",
  1148.     "exp : '-' exp",
  1149.     "exp : '!' exp",
  1150.     "exp : '~' exp",
  1151.     "exp : INCREMENT exp",
  1152.     "exp : DECREMENT exp",
  1153.     "exp : exp INCREMENT",
  1154.     "exp : exp DECREMENT",
  1155.     "exp : SIZEOF exp",
  1156.     "exp : exp ARROW name",
  1157.     "exp : exp ARROW qualified_name",
  1158.     "exp : exp ARROW '*' exp",
  1159.     "exp : exp '.' name",
  1160.     "exp : exp '.' qualified_name",
  1161.     "exp : exp '.' '*' exp",
  1162.     "exp : exp '[' exp1 ']'",
  1163.     "exp : exp '('",
  1164.     "exp : exp '(' arglist ')'",
  1165.     "lcurly : '{'",
  1166.     "arglist : /* empty */",
  1167.     "arglist : exp",
  1168.     "arglist : arglist ',' exp",
  1169.     "rcurly : '}'",
  1170.     "exp : lcurly arglist rcurly",
  1171.     "exp : lcurly type rcurly exp",
  1172.     "exp : '(' type ')' exp",
  1173.     "exp : '(' exp1 ')'",
  1174.     "exp : exp '@' exp",
  1175.     "exp : exp '*' exp",
  1176.     "exp : exp '/' exp",
  1177.     "exp : exp '%' exp",
  1178.     "exp : exp '+' exp",
  1179.     "exp : exp '-' exp",
  1180.     "exp : exp LSH exp",
  1181.     "exp : exp RSH exp",
  1182.     "exp : exp EQUAL exp",
  1183.     "exp : exp NOTEQUAL exp",
  1184.     "exp : exp LEQ exp",
  1185.     "exp : exp GEQ exp",
  1186.     "exp : exp '<' exp",
  1187.     "exp : exp '>' exp",
  1188.     "exp : exp '&' exp",
  1189.     "exp : exp '^' exp",
  1190.     "exp : exp '|' exp",
  1191.     "exp : exp ANDAND exp",
  1192.     "exp : exp OROR exp",
  1193.     "exp : exp '?' exp ':' exp",
  1194.     "exp : exp '=' exp",
  1195.     "exp : exp ASSIGN_MODIFY exp",
  1196.     "exp : INT",
  1197.     "exp : NAME_OR_INT",
  1198.     "exp : FLOAT",
  1199.     "exp : variable",
  1200.     "exp : LAST",
  1201.     "exp : REGNAME",
  1202.     "exp : VARIABLE",
  1203.     "exp : SIZEOF '(' type ')'",
  1204.     "exp : STRING",
  1205.     "exp : THIS",
  1206.     "block : BLOCKNAME",
  1207.     "block : block COLONCOLON name",
  1208.     "variable : block COLONCOLON name",
  1209.     "qualified_name : typebase COLONCOLON name",
  1210.     "qualified_name : typebase COLONCOLON '~' name",
  1211.     "variable : qualified_name",
  1212.     "variable : COLONCOLON name",
  1213.     "variable : name_not_typename",
  1214.     "ptype : typebase",
  1215.     "ptype : typebase CONST_KEYWORD",
  1216.     "ptype : typebase VOLATILE_KEYWORD",
  1217.     "ptype : typebase abs_decl",
  1218.     "ptype : typebase CONST_KEYWORD abs_decl",
  1219.     "ptype : typebase VOLATILE_KEYWORD abs_decl",
  1220.     "abs_decl : '*'",
  1221.     "abs_decl : '*' abs_decl",
  1222.     "abs_decl : '&'",
  1223.     "abs_decl : '&' abs_decl",
  1224.     "abs_decl : direct_abs_decl",
  1225.     "direct_abs_decl : '(' abs_decl ')'",
  1226.     "direct_abs_decl : direct_abs_decl array_mod",
  1227.     "direct_abs_decl : array_mod",
  1228.     "direct_abs_decl : direct_abs_decl func_mod",
  1229.     "direct_abs_decl : func_mod",
  1230.     "array_mod : '[' ']'",
  1231.     "array_mod : '[' INT ']'",
  1232.     "func_mod : '(' ')'",
  1233.     "func_mod : '(' nonempty_typelist ')'",
  1234.     "type : ptype",
  1235.     "type : typebase COLONCOLON '*'",
  1236.     "typebase : TYPENAME",
  1237.     "typebase : INT_KEYWORD",
  1238.     "typebase : LONG",
  1239.     "typebase : SHORT",
  1240.     "typebase : LONG INT_KEYWORD",
  1241.     "typebase : UNSIGNED LONG INT_KEYWORD",
  1242.     "typebase : LONG LONG",
  1243.     "typebase : LONG LONG INT_KEYWORD",
  1244.     "typebase : UNSIGNED LONG LONG",
  1245.     "typebase : UNSIGNED LONG LONG INT_KEYWORD",
  1246.     "typebase : SHORT INT_KEYWORD",
  1247.     "typebase : UNSIGNED SHORT INT_KEYWORD",
  1248.     "typebase : STRUCT name",
  1249.     "typebase : CLASS name",
  1250.     "typebase : UNION name",
  1251.     "typebase : ENUM name",
  1252.     "typebase : UNSIGNED typename",
  1253.     "typebase : UNSIGNED",
  1254.     "typebase : SIGNED_KEYWORD typename",
  1255.     "typebase : SIGNED_KEYWORD",
  1256.     "typebase : TEMPLATE name '<' type '>'",
  1257.     "typebase : CONST_KEYWORD typebase",
  1258.     "typebase : VOLATILE_KEYWORD typebase",
  1259.     "typename : TYPENAME",
  1260.     "typename : INT_KEYWORD",
  1261.     "typename : LONG",
  1262.     "typename : SHORT",
  1263.     "nonempty_typelist : type",
  1264.     "nonempty_typelist : nonempty_typelist ',' type",
  1265.     "name : NAME",
  1266.     "name : BLOCKNAME",
  1267.     "name : TYPENAME",
  1268.     "name : NAME_OR_INT",
  1269.     "name_not_typename : NAME",
  1270.     "name_not_typename : BLOCKNAME",
  1271. };
  1272. #endif /* YYDEBUG */
  1273. #line 1 "/usr/lib/yaccpar"
  1274. /*    @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10    */
  1275.  
  1276. /*
  1277. ** Skeleton parser driver for yacc output
  1278. */
  1279.  
  1280. /*
  1281. ** yacc user known macros and defines
  1282. */
  1283. #define YYERROR        goto yyerrlab
  1284. #define YYACCEPT    { free(yys); free(yyv); return(0); }
  1285. #define YYABORT        { free(yys); free(yyv); return(1); }
  1286. #define YYBACKUP( newtoken, newvalue )\
  1287. {\
  1288.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  1289.     {\
  1290.         yyerror( "syntax error - cannot backup" );\
  1291.         goto yyerrlab;\
  1292.     }\
  1293.     yychar = newtoken;\
  1294.     yystate = *yyps;\
  1295.     yylval = newvalue;\
  1296.     goto yynewstate;\
  1297. }
  1298. #define YYRECOVERING()    (!!yyerrflag)
  1299. #ifndef YYDEBUG
  1300. #    define YYDEBUG    1    /* make debugging available */
  1301. #endif
  1302.  
  1303. /*
  1304. ** user known globals
  1305. */
  1306. int yydebug;            /* set to 1 to get debugging */
  1307.  
  1308. /*
  1309. ** driver internal defines
  1310. */
  1311. #define YYFLAG        (-1000)
  1312.  
  1313. /*
  1314. ** static variables used by the parser
  1315. */
  1316. static YYSTYPE *yyv;            /* value stack */
  1317. static int *yys;            /* state stack */
  1318.  
  1319. static YYSTYPE *yypv;            /* top of value stack */
  1320. static int *yyps;            /* top of state stack */
  1321.  
  1322. static int yystate;            /* current state */
  1323. static int yytmp;            /* extra var (lasts between blocks) */
  1324.  
  1325. int yynerrs;            /* number of errors */
  1326.  
  1327. int yyerrflag;            /* error recovery flag */
  1328. int yychar;            /* current input token number */
  1329.  
  1330.  
  1331. /*
  1332. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  1333. */
  1334. int
  1335. yyparse()
  1336. {
  1337.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  1338.     unsigned yymaxdepth = YYMAXDEPTH;
  1339.  
  1340.     /*
  1341.     ** Initialize externals - yyparse may be called more than once
  1342.     */
  1343.     yyv = (YYSTYPE*)xmalloc(yymaxdepth*sizeof(YYSTYPE));
  1344.     yys = (int*)xmalloc(yymaxdepth*sizeof(int));
  1345.     if (!yyv || !yys)
  1346.     {
  1347.         yyerror( "out of memory" );
  1348.         return(1);
  1349.     }
  1350.     yypv = &yyv[-1];
  1351.     yyps = &yys[-1];
  1352.     yystate = 0;
  1353.     yytmp = 0;
  1354.     yynerrs = 0;
  1355.     yyerrflag = 0;
  1356.     yychar = -1;
  1357.  
  1358.     goto yystack;
  1359.     {
  1360.         register YYSTYPE *yy_pv;    /* top of value stack */
  1361.         register int *yy_ps;        /* top of state stack */
  1362.         register int yy_state;        /* current state */
  1363.         register int  yy_n;        /* internal state number info */
  1364.  
  1365.         /*
  1366.         ** get globals into registers.
  1367.         ** branch to here only if YYBACKUP was called.
  1368.         */
  1369.     yynewstate:
  1370.         yy_pv = yypv;
  1371.         yy_ps = yyps;
  1372.         yy_state = yystate;
  1373.         goto yy_newstate;
  1374.  
  1375.         /*
  1376.         ** get globals into registers.
  1377.         ** either we just started, or we just finished a reduction
  1378.         */
  1379.     yystack:
  1380.         yy_pv = yypv;
  1381.         yy_ps = yyps;
  1382.         yy_state = yystate;
  1383.  
  1384.         /*
  1385.         ** top of for (;;) loop while no reductions done
  1386.         */
  1387.     yy_stack:
  1388.         /*
  1389.         ** put a state and value onto the stacks
  1390.         */
  1391. #if YYDEBUG
  1392.         /*
  1393.         ** if debugging, look up token value in list of value vs.
  1394.         ** name pairs.  0 and negative (-1) are special values.
  1395.         ** Note: linear search is used since time is not a real
  1396.         ** consideration while debugging.
  1397.         */
  1398.         if ( yydebug )
  1399.         {
  1400.             register int yy_i;
  1401.  
  1402.             (void)printf( "State %d, token ", yy_state );
  1403.             if ( yychar == 0 )
  1404.                 (void)printf( "end-of-file\n" );
  1405.             else if ( yychar < 0 )
  1406.                 (void)printf( "-none-\n" );
  1407.             else
  1408.             {
  1409.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1410.                     yy_i++ )
  1411.                 {
  1412.                     if ( yytoks[yy_i].t_val == yychar )
  1413.                         break;
  1414.                 }
  1415.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1416.             }
  1417.         }
  1418. #endif /* YYDEBUG */
  1419.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  1420.         {
  1421.             /*
  1422.             ** xreallocate and recover.  Note that pointers
  1423.             ** have to be reset, or bad things will happen
  1424.             */
  1425.             int yyps_index = (yy_ps - yys);
  1426.             int yypv_index = (yy_pv - yyv);
  1427.             int yypvt_index = (yypvt - yyv);
  1428.             yymaxdepth += YYMAXDEPTH;
  1429.             yyv = (YYSTYPE*)xrealloc((char*)yyv,
  1430.                 yymaxdepth * sizeof(YYSTYPE));
  1431.             yys = (int*)xrealloc((char*)yys,
  1432.                 yymaxdepth * sizeof(int));
  1433.             if (!yyv || !yys)
  1434.             {
  1435.                 yyerror( "yacc stack overflow" );
  1436.                 return(1);
  1437.             }
  1438.             yy_ps = yys + yyps_index;
  1439.             yy_pv = yyv + yypv_index;
  1440.             yypvt = yyv + yypvt_index;
  1441.         }
  1442.         *yy_ps = yy_state;
  1443.         *++yy_pv = yyval;
  1444.  
  1445.         /*
  1446.         ** we have a new state - find out what to do
  1447.         */
  1448.     yy_newstate:
  1449.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  1450.             goto yydefault;        /* simple state */
  1451. #if YYDEBUG
  1452.         /*
  1453.         ** if debugging, need to mark whether new token grabbed
  1454.         */
  1455.         yytmp = yychar < 0;
  1456. #endif
  1457.         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1458.             yychar = 0;        /* reached EOF */
  1459. #if YYDEBUG
  1460.         if ( yydebug && yytmp )
  1461.         {
  1462.             register int yy_i;
  1463.  
  1464.             (void)printf( "Received token " );
  1465.             if ( yychar == 0 )
  1466.                 (void)printf( "end-of-file\n" );
  1467.             else if ( yychar < 0 )
  1468.                 (void)printf( "-none-\n" );
  1469.             else
  1470.             {
  1471.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1472.                     yy_i++ )
  1473.                 {
  1474.                     if ( yytoks[yy_i].t_val == yychar )
  1475.                         break;
  1476.                 }
  1477.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1478.             }
  1479.         }
  1480. #endif /* YYDEBUG */
  1481.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  1482.             goto yydefault;
  1483.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  1484.         {
  1485.             yychar = -1;
  1486.             yyval = yylval;
  1487.             yy_state = yy_n;
  1488.             if ( yyerrflag > 0 )
  1489.                 yyerrflag--;
  1490.             goto yy_stack;
  1491.         }
  1492.  
  1493.     yydefault:
  1494.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  1495.         {
  1496. #if YYDEBUG
  1497.             yytmp = yychar < 0;
  1498. #endif
  1499.             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1500.                 yychar = 0;        /* reached EOF */
  1501. #if YYDEBUG
  1502.             if ( yydebug && yytmp )
  1503.             {
  1504.                 register int yy_i;
  1505.  
  1506.                 (void)printf( "Received token " );
  1507.                 if ( yychar == 0 )
  1508.                     (void)printf( "end-of-file\n" );
  1509.                 else if ( yychar < 0 )
  1510.                     (void)printf( "-none-\n" );
  1511.                 else
  1512.                 {
  1513.                     for ( yy_i = 0;
  1514.                         yytoks[yy_i].t_val >= 0;
  1515.                         yy_i++ )
  1516.                     {
  1517.                         if ( yytoks[yy_i].t_val
  1518.                             == yychar )
  1519.                         {
  1520.                             break;
  1521.                         }
  1522.                     }
  1523.                     (void)printf( "%s\n", yytoks[yy_i].t_name );
  1524.                 }
  1525.             }
  1526. #endif /* YYDEBUG */
  1527.             /*
  1528.             ** look through exception table
  1529.             */
  1530.             {
  1531.                 register int *yyxi = yyexca;
  1532.  
  1533.                 while ( ( *yyxi != -1 ) ||
  1534.                     ( yyxi[1] != yy_state ) )
  1535.                 {
  1536.                     yyxi += 2;
  1537.                 }
  1538.                 while ( ( *(yyxi += 2) >= 0 ) &&
  1539.                     ( *yyxi != yychar ) )
  1540.                     ;
  1541.                 if ( ( yy_n = yyxi[1] ) < 0 )
  1542.                     YYACCEPT;
  1543.             }
  1544.         }
  1545.  
  1546.         /*
  1547.         ** check for syntax error
  1548.         */
  1549.         if ( yy_n == 0 )    /* have an error */
  1550.         {
  1551.             /* no worry about speed here! */
  1552.             switch ( yyerrflag )
  1553.             {
  1554.             case 0:        /* new error */
  1555.                 yyerror( "syntax error" );
  1556.                 goto skip_init;
  1557.             yyerrlab:
  1558.                 /*
  1559.                 ** get globals into registers.
  1560.                 ** we have a user generated syntax type error
  1561.                 */
  1562.                 yy_pv = yypv;
  1563.                 yy_ps = yyps;
  1564.                 yy_state = yystate;
  1565.                 yynerrs++;
  1566.             skip_init:
  1567.             case 1:
  1568.             case 2:        /* incompletely recovered error */
  1569.                     /* try again... */
  1570.                 yyerrflag = 3;
  1571.                 /*
  1572.                 ** find state where "error" is a legal
  1573.                 ** shift action
  1574.                 */
  1575.                 while ( yy_ps >= yys )
  1576.                 {
  1577.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  1578.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  1579.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  1580.                         /*
  1581.                         ** simulate shift of "error"
  1582.                         */
  1583.                         yy_state = yyact[ yy_n ];
  1584.                         goto yy_stack;
  1585.                     }
  1586.                     /*
  1587.                     ** current state has no shift on
  1588.                     ** "error", pop stack
  1589.                     */
  1590. #if YYDEBUG
  1591. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  1592.                     if ( yydebug )
  1593.                         (void)printf( _POP_, *yy_ps,
  1594.                             yy_ps[-1] );
  1595. #    undef _POP_
  1596. #endif
  1597.                     yy_ps--;
  1598.                     yy_pv--;
  1599.                 }
  1600.                 /*
  1601.                 ** there is no state on stack with "error" as
  1602.                 ** a valid shift.  give up.
  1603.                 */
  1604.                 YYABORT;
  1605.             case 3:        /* no shift yet; eat a token */
  1606. #if YYDEBUG
  1607.                 /*
  1608.                 ** if debugging, look up token in list of
  1609.                 ** pairs.  0 and negative shouldn't occur,
  1610.                 ** but since timing doesn't matter when
  1611.                 ** debugging, it doesn't hurt to leave the
  1612.                 ** tests here.
  1613.                 */
  1614.                 if ( yydebug )
  1615.                 {
  1616.                     register int yy_i;
  1617.  
  1618.                     (void)printf( "Error recovery discards " );
  1619.                     if ( yychar == 0 )
  1620.                         (void)printf( "token end-of-file\n" );
  1621.                     else if ( yychar < 0 )
  1622.                         (void)printf( "token -none-\n" );
  1623.                     else
  1624.                     {
  1625.                         for ( yy_i = 0;
  1626.                             yytoks[yy_i].t_val >= 0;
  1627.                             yy_i++ )
  1628.                         {
  1629.                             if ( yytoks[yy_i].t_val
  1630.                                 == yychar )
  1631.                             {
  1632.                                 break;
  1633.                             }
  1634.                         }
  1635.                         (void)printf( "token %s\n",
  1636.                             yytoks[yy_i].t_name );
  1637.                     }
  1638.                 }
  1639. #endif /* YYDEBUG */
  1640.                 if ( yychar == 0 )    /* reached EOF. quit */
  1641.                     YYABORT;
  1642.                 yychar = -1;
  1643.                 goto yy_newstate;
  1644.             }
  1645.         }/* end if ( yy_n == 0 ) */
  1646.         /*
  1647.         ** reduction by production yy_n
  1648.         ** put stack tops, etc. so things right after switch
  1649.         */
  1650. #if YYDEBUG
  1651.         /*
  1652.         ** if debugging, print the string that is the user's
  1653.         ** specification of the reduction which is just about
  1654.         ** to be done.
  1655.         */
  1656.         if ( yydebug )
  1657.             (void)printf( "Reduce by (%d) \"%s\"\n",
  1658.                 yy_n, yyreds[ yy_n ] );
  1659. #endif
  1660.         yytmp = yy_n;            /* value to switch over */
  1661.         yypvt = yy_pv;            /* $vars top of value stack */
  1662.         /*
  1663.         ** Look in goto table for next state
  1664.         ** Sorry about using yy_state here as temporary
  1665.         ** register variable, but why not, if it works...
  1666.         ** If yyr2[ yy_n ] doesn't have the low order bit
  1667.         ** set, then there is no action to be done for
  1668.         ** this reduction.  So, no saving & unsaving of
  1669.         ** registers done.  The only difference between the
  1670.         ** code just after the if and the body of the if is
  1671.         ** the goto yy_stack in the body.  This way the test
  1672.         ** can be made before the choice of what to do is needed.
  1673.         */
  1674.         {
  1675.             /* length of production doubled with extra bit */
  1676.             register int yy_len = yyr2[ yy_n ];
  1677.  
  1678.             if ( !( yy_len & 01 ) )
  1679.             {
  1680.                 yy_len >>= 1;
  1681.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1682.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1683.                     *( yy_ps -= yy_len ) + 1;
  1684.                 if ( yy_state >= YYLAST ||
  1685.                     yychk[ yy_state =
  1686.                     yyact[ yy_state ] ] != -yy_n )
  1687.                 {
  1688.                     yy_state = yyact[ yypgo[ yy_n ] ];
  1689.                 }
  1690.                 goto yy_stack;
  1691.             }
  1692.             yy_len >>= 1;
  1693.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1694.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1695.                 *( yy_ps -= yy_len ) + 1;
  1696.             if ( yy_state >= YYLAST ||
  1697.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  1698.             {
  1699.                 yy_state = yyact[ yypgo[ yy_n ] ];
  1700.             }
  1701.         }
  1702.                     /* save until reenter driver code */
  1703.         yystate = yy_state;
  1704.         yyps = yy_ps;
  1705.         yypv = yy_pv;
  1706.     }
  1707.     /*
  1708.     ** code supplied by user is placed in this switch
  1709.     */
  1710.     switch( yytmp )
  1711.     {
  1712.         
  1713. case 3:
  1714. # line 214 "./c-exp.y"
  1715. { write_exp_elt_opcode(OP_TYPE);
  1716.               write_exp_elt_type(yypvt[-0].tval);
  1717.               write_exp_elt_opcode(OP_TYPE);} break;
  1718. case 5:
  1719. # line 222 "./c-exp.y"
  1720. { write_exp_elt_opcode (BINOP_COMMA); } break;
  1721. case 6:
  1722. # line 227 "./c-exp.y"
  1723. { write_exp_elt_opcode (UNOP_IND); } break;
  1724. case 7:
  1725. # line 230 "./c-exp.y"
  1726. { write_exp_elt_opcode (UNOP_ADDR); } break;
  1727. case 8:
  1728. # line 233 "./c-exp.y"
  1729. { write_exp_elt_opcode (UNOP_NEG); } break;
  1730. case 9:
  1731. # line 237 "./c-exp.y"
  1732. { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } break;
  1733. case 10:
  1734. # line 241 "./c-exp.y"
  1735. { write_exp_elt_opcode (UNOP_COMPLEMENT); } break;
  1736. case 11:
  1737. # line 245 "./c-exp.y"
  1738. { write_exp_elt_opcode (UNOP_PREINCREMENT); } break;
  1739. case 12:
  1740. # line 249 "./c-exp.y"
  1741. { write_exp_elt_opcode (UNOP_PREDECREMENT); } break;
  1742. case 13:
  1743. # line 253 "./c-exp.y"
  1744. { write_exp_elt_opcode (UNOP_POSTINCREMENT); } break;
  1745. case 14:
  1746. # line 257 "./c-exp.y"
  1747. { write_exp_elt_opcode (UNOP_POSTDECREMENT); } break;
  1748. case 15:
  1749. # line 261 "./c-exp.y"
  1750. { write_exp_elt_opcode (UNOP_SIZEOF); } break;
  1751. case 16:
  1752. # line 265 "./c-exp.y"
  1753. { write_exp_elt_opcode (STRUCTOP_PTR);
  1754.               write_exp_string (yypvt[-0].sval);
  1755.               write_exp_elt_opcode (STRUCTOP_PTR); } break;
  1756. case 17:
  1757. # line 271 "./c-exp.y"
  1758. { /* exp->type::name becomes exp->*(&type::name) */
  1759.               /* Note: this doesn't work if name is a
  1760.                  static member!  FIXME */
  1761.               write_exp_elt_opcode (UNOP_ADDR);
  1762.               write_exp_elt_opcode (STRUCTOP_MPTR); } break;
  1763. case 18:
  1764. # line 278 "./c-exp.y"
  1765. { write_exp_elt_opcode (STRUCTOP_MPTR); } break;
  1766. case 19:
  1767. # line 282 "./c-exp.y"
  1768. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  1769.               write_exp_string (yypvt[-0].sval);
  1770.               write_exp_elt_opcode (STRUCTOP_STRUCT); } break;
  1771. case 20:
  1772. # line 288 "./c-exp.y"
  1773. { /* exp.type::name becomes exp.*(&type::name) */
  1774.               /* Note: this doesn't work if name is a
  1775.                  static member!  FIXME */
  1776.               write_exp_elt_opcode (UNOP_ADDR);
  1777.               write_exp_elt_opcode (STRUCTOP_MEMBER); } break;
  1778. case 21:
  1779. # line 296 "./c-exp.y"
  1780. { write_exp_elt_opcode (STRUCTOP_MEMBER); } break;
  1781. case 22:
  1782. # line 300 "./c-exp.y"
  1783. { write_exp_elt_opcode (BINOP_SUBSCRIPT); } break;
  1784. case 23:
  1785. # line 306 "./c-exp.y"
  1786. { start_arglist (); } break;
  1787. case 24:
  1788. # line 308 "./c-exp.y"
  1789. { write_exp_elt_opcode (OP_FUNCALL);
  1790.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  1791.               write_exp_elt_opcode (OP_FUNCALL); } break;
  1792. case 25:
  1793. # line 314 "./c-exp.y"
  1794. { start_arglist (); } break;
  1795. case 27:
  1796. # line 321 "./c-exp.y"
  1797. { arglist_len = 1; } break;
  1798. case 28:
  1799. # line 325 "./c-exp.y"
  1800. { arglist_len++; } break;
  1801. case 29:
  1802. # line 329 "./c-exp.y"
  1803. { yyval.lval = end_arglist () - 1; } break;
  1804. case 30:
  1805. # line 332 "./c-exp.y"
  1806. { write_exp_elt_opcode (OP_ARRAY);
  1807.               write_exp_elt_longcst ((LONGEST) 0);
  1808.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1809.               write_exp_elt_opcode (OP_ARRAY); } break;
  1810. case 31:
  1811. # line 339 "./c-exp.y"
  1812. { write_exp_elt_opcode (UNOP_MEMVAL);
  1813.               write_exp_elt_type (yypvt[-2].tval);
  1814.               write_exp_elt_opcode (UNOP_MEMVAL); } break;
  1815. case 32:
  1816. # line 345 "./c-exp.y"
  1817. { write_exp_elt_opcode (UNOP_CAST);
  1818.               write_exp_elt_type (yypvt[-2].tval);
  1819.               write_exp_elt_opcode (UNOP_CAST); } break;
  1820. case 33:
  1821. # line 351 "./c-exp.y"
  1822. { } break;
  1823. case 34:
  1824. # line 357 "./c-exp.y"
  1825. { write_exp_elt_opcode (BINOP_REPEAT); } break;
  1826. case 35:
  1827. # line 361 "./c-exp.y"
  1828. { write_exp_elt_opcode (BINOP_MUL); } break;
  1829. case 36:
  1830. # line 365 "./c-exp.y"
  1831. { write_exp_elt_opcode (BINOP_DIV); } break;
  1832. case 37:
  1833. # line 369 "./c-exp.y"
  1834. { write_exp_elt_opcode (BINOP_REM); } break;
  1835. case 38:
  1836. # line 373 "./c-exp.y"
  1837. { write_exp_elt_opcode (BINOP_ADD); } break;
  1838. case 39:
  1839. # line 377 "./c-exp.y"
  1840. { write_exp_elt_opcode (BINOP_SUB); } break;
  1841. case 40:
  1842. # line 381 "./c-exp.y"
  1843. { write_exp_elt_opcode (BINOP_LSH); } break;
  1844. case 41:
  1845. # line 385 "./c-exp.y"
  1846. { write_exp_elt_opcode (BINOP_RSH); } break;
  1847. case 42:
  1848. # line 389 "./c-exp.y"
  1849. { write_exp_elt_opcode (BINOP_EQUAL); } break;
  1850. case 43:
  1851. # line 393 "./c-exp.y"
  1852. { write_exp_elt_opcode (BINOP_NOTEQUAL); } break;
  1853. case 44:
  1854. # line 397 "./c-exp.y"
  1855. { write_exp_elt_opcode (BINOP_LEQ); } break;
  1856. case 45:
  1857. # line 401 "./c-exp.y"
  1858. { write_exp_elt_opcode (BINOP_GEQ); } break;
  1859. case 46:
  1860. # line 405 "./c-exp.y"
  1861. { write_exp_elt_opcode (BINOP_LESS); } break;
  1862. case 47:
  1863. # line 409 "./c-exp.y"
  1864. { write_exp_elt_opcode (BINOP_GTR); } break;
  1865. case 48:
  1866. # line 413 "./c-exp.y"
  1867. { write_exp_elt_opcode (BINOP_BITWISE_AND); } break;
  1868. case 49:
  1869. # line 417 "./c-exp.y"
  1870. { write_exp_elt_opcode (BINOP_BITWISE_XOR); } break;
  1871. case 50:
  1872. # line 421 "./c-exp.y"
  1873. { write_exp_elt_opcode (BINOP_BITWISE_IOR); } break;
  1874. case 51:
  1875. # line 425 "./c-exp.y"
  1876. { write_exp_elt_opcode (BINOP_LOGICAL_AND); } break;
  1877. case 52:
  1878. # line 429 "./c-exp.y"
  1879. { write_exp_elt_opcode (BINOP_LOGICAL_OR); } break;
  1880. case 53:
  1881. # line 433 "./c-exp.y"
  1882. { write_exp_elt_opcode (TERNOP_COND); } break;
  1883. case 54:
  1884. # line 437 "./c-exp.y"
  1885. { write_exp_elt_opcode (BINOP_ASSIGN); } break;
  1886. case 55:
  1887. # line 441 "./c-exp.y"
  1888. { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
  1889.               write_exp_elt_opcode (yypvt[-1].opcode);
  1890.               write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); } break;
  1891. case 56:
  1892. # line 447 "./c-exp.y"
  1893. { write_exp_elt_opcode (OP_LONG);
  1894.               write_exp_elt_type (yypvt[-0].typed_val.type);
  1895.               write_exp_elt_longcst ((LONGEST)(yypvt[-0].typed_val.val));
  1896.               write_exp_elt_opcode (OP_LONG); } break;
  1897. case 57:
  1898. # line 454 "./c-exp.y"
  1899. { YYSTYPE val;
  1900.               parse_number (yypvt[-0].ssym.stoken.ptr, yypvt[-0].ssym.stoken.length, 0, &val);
  1901.               write_exp_elt_opcode (OP_LONG);
  1902.               write_exp_elt_type (val.typed_val.type);
  1903.               write_exp_elt_longcst ((LONGEST)val.typed_val.val);
  1904.               write_exp_elt_opcode (OP_LONG);
  1905.             } break;
  1906. case 58:
  1907. # line 465 "./c-exp.y"
  1908. { write_exp_elt_opcode (OP_DOUBLE);
  1909.               write_exp_elt_type (builtin_type_double);
  1910.               write_exp_elt_dblcst (yypvt[-0].dval);
  1911.               write_exp_elt_opcode (OP_DOUBLE); } break;
  1912. case 60:
  1913. # line 475 "./c-exp.y"
  1914. { write_exp_elt_opcode (OP_LAST);
  1915.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1916.               write_exp_elt_opcode (OP_LAST); } break;
  1917. case 61:
  1918. # line 481 "./c-exp.y"
  1919. { write_exp_elt_opcode (OP_REGISTER);
  1920.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1921.               write_exp_elt_opcode (OP_REGISTER); } break;
  1922. case 62:
  1923. # line 487 "./c-exp.y"
  1924. { write_exp_elt_opcode (OP_INTERNALVAR);
  1925.               write_exp_elt_intern (yypvt[-0].ivar);
  1926.               write_exp_elt_opcode (OP_INTERNALVAR); } break;
  1927. case 63:
  1928. # line 493 "./c-exp.y"
  1929. { write_exp_elt_opcode (OP_LONG);
  1930.               write_exp_elt_type (builtin_type_int);
  1931.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yypvt[-1].tval));
  1932.               write_exp_elt_opcode (OP_LONG); } break;
  1933. case 64:
  1934. # line 500 "./c-exp.y"
  1935. { /* C strings are converted into array constants with
  1936.                  an explicit null byte added at the end.  Thus
  1937.                  the array upper bound is the string length.
  1938.                  There is no such thing in C as a completely empty
  1939.                  string. */
  1940.               char *sp = yypvt[-0].sval.ptr; int count = yypvt[-0].sval.length;
  1941.               while (count-- > 0)
  1942.                 {
  1943.                   write_exp_elt_opcode (OP_LONG);
  1944.                   write_exp_elt_type (builtin_type_char);
  1945.                   write_exp_elt_longcst ((LONGEST)(*sp++));
  1946.                   write_exp_elt_opcode (OP_LONG);
  1947.                 }
  1948.               write_exp_elt_opcode (OP_LONG);
  1949.               write_exp_elt_type (builtin_type_char);
  1950.               write_exp_elt_longcst ((LONGEST)'\0');
  1951.               write_exp_elt_opcode (OP_LONG);
  1952.               write_exp_elt_opcode (OP_ARRAY);
  1953.               write_exp_elt_longcst ((LONGEST) 0);
  1954.               write_exp_elt_longcst ((LONGEST) (yypvt[-0].sval.length));
  1955.               write_exp_elt_opcode (OP_ARRAY); } break;
  1956. case 65:
  1957. # line 525 "./c-exp.y"
  1958. { write_exp_elt_opcode (OP_THIS);
  1959.               write_exp_elt_opcode (OP_THIS); } break;
  1960. case 66:
  1961. # line 532 "./c-exp.y"
  1962. {
  1963.               if (yypvt[-0].ssym.sym != 0)
  1964.                   yyval.bval = SYMBOL_BLOCK_VALUE (yypvt[-0].ssym.sym);
  1965.               else
  1966.                 {
  1967.                   struct symtab *tem =
  1968.                   lookup_symtab (copy_name (yypvt[-0].ssym.stoken));
  1969.                   if (tem)
  1970.                 yyval.bval = BLOCKVECTOR_BLOCK
  1971.                      (BLOCKVECTOR (tem), STATIC_BLOCK);
  1972.                   else
  1973.                 error ("No file or function \"%s\".",
  1974.                        copy_name (yypvt[-0].ssym.stoken));
  1975.                 }
  1976.             } break;
  1977. case 67:
  1978. # line 550 "./c-exp.y"
  1979. { struct symbol *tem
  1980.                 = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1981.                          VAR_NAMESPACE, (int *) NULL,
  1982.                          (struct symtab **) NULL);
  1983.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1984.                 error ("No function \"%s\" in specified context.",
  1985.                    copy_name (yypvt[-0].sval));
  1986.               yyval.bval = SYMBOL_BLOCK_VALUE (tem); } break;
  1987. case 68:
  1988. # line 561 "./c-exp.y"
  1989. { struct symbol *sym;
  1990.               sym = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1991.                            VAR_NAMESPACE, (int *) NULL,
  1992.                            (struct symtab **) NULL);
  1993.               if (sym == 0)
  1994.                 error ("No symbol \"%s\" in specified context.",
  1995.                    copy_name (yypvt[-0].sval));
  1996.  
  1997.               write_exp_elt_opcode (OP_VAR_VALUE);
  1998.               /* block_found is set by lookup_symbol.  */
  1999.               write_exp_elt_block (block_found);
  2000.               write_exp_elt_sym (sym);
  2001.               write_exp_elt_opcode (OP_VAR_VALUE); } break;
  2002. case 69:
  2003. # line 577 "./c-exp.y"
  2004. {
  2005.               struct type *type = yypvt[-2].tval;
  2006.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  2007.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  2008.                 error ("`%s' is not defined as an aggregate type.",
  2009.                    TYPE_NAME (type));
  2010.  
  2011.               write_exp_elt_opcode (OP_SCOPE);
  2012.               write_exp_elt_type (type);
  2013.               write_exp_string (yypvt[-0].sval);
  2014.               write_exp_elt_opcode (OP_SCOPE);
  2015.             } break;
  2016. case 70:
  2017. # line 590 "./c-exp.y"
  2018. {
  2019.               struct type *type = yypvt[-3].tval;
  2020.               struct stoken tmp_token;
  2021.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  2022.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  2023.                 error ("`%s' is not defined as an aggregate type.",
  2024.                    TYPE_NAME (type));
  2025.  
  2026.               if (!STREQ (type_name_no_tag (type), yypvt[-0].sval.ptr))
  2027.                 error ("invalid destructor `%s::~%s'",
  2028.                    type_name_no_tag (type), yypvt[-0].sval.ptr);
  2029.  
  2030.               tmp_token.ptr = (char*) alloca (yypvt[-0].sval.length + 2);
  2031.               tmp_token.length = yypvt[-0].sval.length + 1;
  2032.               tmp_token.ptr[0] = '~';
  2033.               memcpy (tmp_token.ptr+1, yypvt[-0].sval.ptr, yypvt[-0].sval.length);
  2034.               tmp_token.ptr[tmp_token.length] = 0;
  2035.               write_exp_elt_opcode (OP_SCOPE);
  2036.               write_exp_elt_type (type);
  2037.               write_exp_string (tmp_token);
  2038.               write_exp_elt_opcode (OP_SCOPE);
  2039.             } break;
  2040. case 72:
  2041. # line 616 "./c-exp.y"
  2042. {
  2043.               char *name = copy_name (yypvt[-0].sval);
  2044.               struct symbol *sym;
  2045.               struct minimal_symbol *msymbol;
  2046.  
  2047.               sym =
  2048.                 lookup_symbol (name, (const struct block *) NULL,
  2049.                        VAR_NAMESPACE, (int *) NULL,
  2050.                        (struct symtab **) NULL);
  2051.               if (sym)
  2052.                 {
  2053.                   write_exp_elt_opcode (OP_VAR_VALUE);
  2054.                   write_exp_elt_block (NULL);
  2055.                   write_exp_elt_sym (sym);
  2056.                   write_exp_elt_opcode (OP_VAR_VALUE);
  2057.                   break;
  2058.                 }
  2059.  
  2060.               msymbol = lookup_minimal_symbol (name,
  2061.                       (struct objfile *) NULL);
  2062.               if (msymbol != NULL)
  2063.                 {
  2064.                   write_exp_msymbol (msymbol,
  2065.                          lookup_function_type (builtin_type_int),
  2066.                          builtin_type_int);
  2067.                 }
  2068.               else
  2069.                 if (!have_full_symbols () && !have_partial_symbols ())
  2070.                   error ("No symbol table is loaded.  Use the \"file\" command.");
  2071.                 else
  2072.                   error ("No symbol \"%s\" in current context.", name);
  2073.             } break;
  2074. case 73:
  2075. # line 651 "./c-exp.y"
  2076. { struct symbol *sym = yypvt[-0].ssym.sym;
  2077.  
  2078.               if (sym)
  2079.                 {
  2080.                   if (symbol_read_needs_frame (sym))
  2081.                 {
  2082.                   if (innermost_block == 0 ||
  2083.                       contained_in (block_found, 
  2084.                             innermost_block))
  2085.                     innermost_block = block_found;
  2086.                 }
  2087.  
  2088.                   write_exp_elt_opcode (OP_VAR_VALUE);
  2089.                   /* We want to use the selected frame, not
  2090.                  another more inner frame which happens to
  2091.                  be in the same block.  */
  2092.                   write_exp_elt_block (NULL);
  2093.                   write_exp_elt_sym (sym);
  2094.                   write_exp_elt_opcode (OP_VAR_VALUE);
  2095.                 }
  2096.               else if (yypvt[-0].ssym.is_a_field_of_this)
  2097.                 {
  2098.                   /* C++: it hangs off of `this'.  Must
  2099.                      not inadvertently convert from a method call
  2100.                  to data ref.  */
  2101.                   if (innermost_block == 0 || 
  2102.                   contained_in (block_found, innermost_block))
  2103.                 innermost_block = block_found;
  2104.                   write_exp_elt_opcode (OP_THIS);
  2105.                   write_exp_elt_opcode (OP_THIS);
  2106.                   write_exp_elt_opcode (STRUCTOP_PTR);
  2107.                   write_exp_string (yypvt[-0].ssym.stoken);
  2108.                   write_exp_elt_opcode (STRUCTOP_PTR);
  2109.                 }
  2110.               else
  2111.                 {
  2112.                   struct minimal_symbol *msymbol;
  2113.                   register char *arg = copy_name (yypvt[-0].ssym.stoken);
  2114.  
  2115.                   msymbol = lookup_minimal_symbol (arg,
  2116.                       (struct objfile *) NULL);
  2117.                   if (msymbol != NULL)
  2118.                 {
  2119.                   write_exp_msymbol (msymbol,
  2120.                              lookup_function_type (builtin_type_int),
  2121.                              builtin_type_int);
  2122.                 }
  2123.                   else if (!have_full_symbols () && !have_partial_symbols ())
  2124.                 error ("No symbol table is loaded.  Use the \"file\" command.");
  2125.                   else
  2126.                 error ("No symbol \"%s\" in current context.",
  2127.                        copy_name (yypvt[-0].ssym.stoken));
  2128.                 }
  2129.             } break;
  2130. case 77:
  2131. # line 717 "./c-exp.y"
  2132. { yyval.tval = follow_types (yypvt[-1].tval); } break;
  2133. case 78:
  2134. # line 719 "./c-exp.y"
  2135. { yyval.tval = follow_types (yypvt[-2].tval); } break;
  2136. case 79:
  2137. # line 721 "./c-exp.y"
  2138. { yyval.tval = follow_types (yypvt[-2].tval); } break;
  2139. case 80:
  2140. # line 725 "./c-exp.y"
  2141. { push_type (tp_pointer); yyval.voidval = 0; } break;
  2142. case 81:
  2143. # line 727 "./c-exp.y"
  2144. { push_type (tp_pointer); yyval.voidval = yypvt[-0].voidval; } break;
  2145. case 82:
  2146. # line 729 "./c-exp.y"
  2147. { push_type (tp_reference); yyval.voidval = 0; } break;
  2148. case 83:
  2149. # line 731 "./c-exp.y"
  2150. { push_type (tp_reference); yyval.voidval = yypvt[-0].voidval; } break;
  2151. case 85:
  2152. # line 736 "./c-exp.y"
  2153. { yyval.voidval = yypvt[-1].voidval; } break;
  2154. case 86:
  2155. # line 738 "./c-exp.y"
  2156. {
  2157.               push_type_int (yypvt[-0].lval);
  2158.               push_type (tp_array);
  2159.             } break;
  2160. case 87:
  2161. # line 743 "./c-exp.y"
  2162. {
  2163.               push_type_int (yypvt[-0].lval);
  2164.               push_type (tp_array);
  2165.               yyval.voidval = 0;
  2166.             } break;
  2167. case 88:
  2168. # line 750 "./c-exp.y"
  2169. { push_type (tp_function); } break;
  2170. case 89:
  2171. # line 752 "./c-exp.y"
  2172. { push_type (tp_function); } break;
  2173. case 90:
  2174. # line 756 "./c-exp.y"
  2175. { yyval.lval = -1; } break;
  2176. case 91:
  2177. # line 758 "./c-exp.y"
  2178. { yyval.lval = yypvt[-1].typed_val.val; } break;
  2179. case 92:
  2180. # line 762 "./c-exp.y"
  2181. { yyval.voidval = 0; } break;
  2182. case 93:
  2183. # line 764 "./c-exp.y"
  2184. { free ((PTR)yypvt[-1].tvec); yyval.voidval = 0; } break;
  2185. case 95:
  2186. # line 777 "./c-exp.y"
  2187. { yyval.tval = lookup_member_type (builtin_type_int, yypvt[-2].tval); } break;
  2188. case 96:
  2189. # line 782 "./c-exp.y"
  2190. { yyval.tval = yypvt[-0].tsym.type; } break;
  2191. case 97:
  2192. # line 784 "./c-exp.y"
  2193. { yyval.tval = builtin_type_int; } break;
  2194. case 98:
  2195. # line 786 "./c-exp.y"
  2196. { yyval.tval = builtin_type_long; } break;
  2197. case 99:
  2198. # line 788 "./c-exp.y"
  2199. { yyval.tval = builtin_type_short; } break;
  2200. case 100:
  2201. # line 790 "./c-exp.y"
  2202. { yyval.tval = builtin_type_long; } break;
  2203. case 101:
  2204. # line 792 "./c-exp.y"
  2205. { yyval.tval = builtin_type_unsigned_long; } break;
  2206. case 102:
  2207. # line 794 "./c-exp.y"
  2208. { yyval.tval = builtin_type_long_long; } break;
  2209. case 103:
  2210. # line 796 "./c-exp.y"
  2211. { yyval.tval = builtin_type_long_long; } break;
  2212. case 104:
  2213. # line 798 "./c-exp.y"
  2214. { yyval.tval = builtin_type_unsigned_long_long; } break;
  2215. case 105:
  2216. # line 800 "./c-exp.y"
  2217. { yyval.tval = builtin_type_unsigned_long_long; } break;
  2218. case 106:
  2219. # line 802 "./c-exp.y"
  2220. { yyval.tval = builtin_type_short; } break;
  2221. case 107:
  2222. # line 804 "./c-exp.y"
  2223. { yyval.tval = builtin_type_unsigned_short; } break;
  2224. case 108:
  2225. # line 806 "./c-exp.y"
  2226. { yyval.tval = lookup_struct (copy_name (yypvt[-0].sval),
  2227.                           expression_context_block); } break;
  2228. case 109:
  2229. # line 809 "./c-exp.y"
  2230. { yyval.tval = lookup_struct (copy_name (yypvt[-0].sval),
  2231.                           expression_context_block); } break;
  2232. case 110:
  2233. # line 812 "./c-exp.y"
  2234. { yyval.tval = lookup_union (copy_name (yypvt[-0].sval),
  2235.                          expression_context_block); } break;
  2236. case 111:
  2237. # line 815 "./c-exp.y"
  2238. { yyval.tval = lookup_enum (copy_name (yypvt[-0].sval),
  2239.                         expression_context_block); } break;
  2240. case 112:
  2241. # line 818 "./c-exp.y"
  2242. { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yypvt[-0].tsym.type)); } break;
  2243. case 113:
  2244. # line 820 "./c-exp.y"
  2245. { yyval.tval = builtin_type_unsigned_int; } break;
  2246. case 114:
  2247. # line 822 "./c-exp.y"
  2248. { yyval.tval = lookup_signed_typename (TYPE_NAME(yypvt[-0].tsym.type)); } break;
  2249. case 115:
  2250. # line 824 "./c-exp.y"
  2251. { yyval.tval = builtin_type_int; } break;
  2252. case 116:
  2253. # line 826 "./c-exp.y"
  2254. { yyval.tval = lookup_template_type(copy_name(yypvt[-3].sval), yypvt[-1].tval,
  2255.                             expression_context_block);
  2256.             } break;
  2257. case 117:
  2258. # line 832 "./c-exp.y"
  2259. { yyval.tval = yypvt[-0].tval; } break;
  2260. case 118:
  2261. # line 833 "./c-exp.y"
  2262. { yyval.tval = yypvt[-0].tval; } break;
  2263. case 120:
  2264. # line 838 "./c-exp.y"
  2265. {
  2266.           yyval.tsym.stoken.ptr = "int";
  2267.           yyval.tsym.stoken.length = 3;
  2268.           yyval.tsym.type = builtin_type_int;
  2269.         } break;
  2270. case 121:
  2271. # line 844 "./c-exp.y"
  2272. {
  2273.           yyval.tsym.stoken.ptr = "long";
  2274.           yyval.tsym.stoken.length = 4;
  2275.           yyval.tsym.type = builtin_type_long;
  2276.         } break;
  2277. case 122:
  2278. # line 850 "./c-exp.y"
  2279. {
  2280.           yyval.tsym.stoken.ptr = "short";
  2281.           yyval.tsym.stoken.length = 5;
  2282.           yyval.tsym.type = builtin_type_short;
  2283.         } break;
  2284. case 123:
  2285. # line 859 "./c-exp.y"
  2286. { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
  2287.           yyval.ivec[0] = 1;    /* Number of types in vector */
  2288.           yyval.tvec[1] = yypvt[-0].tval;
  2289.         } break;
  2290. case 124:
  2291. # line 864 "./c-exp.y"
  2292. { int len = sizeof (struct type *) * (++(yypvt[-2].ivec[0]) + 1);
  2293.           yyval.tvec = (struct type **) xrealloc ((char *) yypvt[-2].tvec, len);
  2294.           yyval.tvec[yyval.ivec[0]] = yypvt[-0].tval;
  2295.         } break;
  2296. case 125:
  2297. # line 870 "./c-exp.y"
  2298. { yyval.sval = yypvt[-0].ssym.stoken; } break;
  2299. case 126:
  2300. # line 871 "./c-exp.y"
  2301. { yyval.sval = yypvt[-0].ssym.stoken; } break;
  2302. case 127:
  2303. # line 872 "./c-exp.y"
  2304. { yyval.sval = yypvt[-0].tsym.stoken; } break;
  2305. case 128:
  2306. # line 873 "./c-exp.y"
  2307. { yyval.sval = yypvt[-0].ssym.stoken; } break;
  2308.     }
  2309.     goto yystack;        /* reset registers in driver code */
  2310. }
  2311.